import WaterfallFlow from '@/pages/exampleList/waterfallFlow/index.tsx'
import VariableTypeEditing from '@/pages/exampleList/variableTypeEditing/index.tsx'
import Uploading from '@/pages/exampleList/uploading/index.tsx'
import UnequalHeightVirtualScroll from '@/pages/exampleList/unequalHeightVirtualScroll/index.tsx'
import Token from '@/pages/exampleList/token/index.tsx'
import Test from '@/pages/exampleList/test/index.tsx'
import RollingSuspension from '@/pages/exampleList/rollingSuspension/index.tsx'
import RichText from '@/pages/exampleList/richText/index.tsx'
import Print from '@/pages/exampleList/print/index.tsx'
import ParticleText from '@/pages/exampleList/particleText/index.tsx'
import OnlineEditing from '@/pages/exampleList/onlineEditing/index.tsx'
import MessageNotification from '@/pages/exampleList/messageNotification/index.tsx'
import MagnifyingGlass from '@/pages/exampleList/magnifyingGlass/index.tsx'
import LazyImg from '@/pages/exampleList/lazyImg/index.tsx'
import GlobalToast from '@/pages/exampleList/globalToast/index.tsx'
import EqualHeightVirtualScroll from '@/pages/exampleList/equalHeightVirtualScroll/index.tsx'
import EnlargePreview from '@/pages/exampleList/enlargePreview/index.tsx'
import Ellipsis from '@/pages/exampleList/ellipsis/index.tsx'
import DigitalRain from '@/pages/exampleList/digitalRain/index.tsx'
import BlobUse from '@/pages/exampleList/blobUse/index.tsx'
import App from '../App.tsx'
import Home from '../pages/home/index.tsx'
import ExampleDetail from '../pages/exampleDetail/index.tsx'
import FunList from '../pages/exampleList'
import Article from '../pages/article/index.tsx'
import NotFound from '../404/index.tsx'
import { createBrowserRouter, createHashRouter, Navigate } from 'react-router-dom'

let childrenList = [{"title":"Canvas粒子文字","sortInd":"1","path":"particleText","element":<ParticleText />},{"title":"Blob的使用场景","path":"blobUse","sortInd":"20","element":<BlobUse />},{"title":"数字雨","path":"digitalRain","sortInd":"20","element":<DigitalRain />},{"title":"自适应省略号","path":"ellipsis","sortInd":"20","element":<Ellipsis />},{"title":"hook实现放大浏览","path":"enlargePreview","sortInd":"20","element":<EnlargePreview />},{"title":"等高虚拟滚动","path":"equalHeightVirtualScroll","sortInd":"20","element":<EqualHeightVirtualScroll />},{"title":"全局Toast","path":"globalToast","sortInd":"20","element":<GlobalToast />},{"title":"懒加载图片","path":"lazyImg","sortInd":"20","element":<LazyImg />},{"title":"放大镜","path":"magnifyingGlass","sortInd":"20","element":<MagnifyingGlass />},{"title":"消息通知","path":"messageNotification","sortInd":"20","element":<MessageNotification />},{"title":"在线编辑","path":"onlineEditing","sortInd":"20","element":<OnlineEditing />},{"title":"打印预览","path":"print","sortInd":"20","element":<Print />},{"title":"富文本","path":"richText","sortInd":"20","element":<RichText />},{"title":"滚动悬浮","path":"rollingSuspension","sortInd":"20","element":<RollingSuspension />},{"title":"测试","path":"test","sortInd":"20","element":<Test />},{"title":"Token刷新","path":"token","sortInd":"20","element":<Token />},{"title":"不等高虚拟列表","path":"unequalHeightVirtualScroll","sortInd":"20","element":<UnequalHeightVirtualScroll />},{"title":"图片上传","path":"uploading","sortInd":"20","element":<Uploading />},{"title":"数据类型编辑","path":"variableTypeEditing","sortInd":"20","element":<VariableTypeEditing />},{"title":"响应式瀑布流","path":"waterfallFlow","sortInd":"20","element":<WaterfallFlow />}];

let children = childrenList.map((item) => {
  return {
    element: item.element,
    path: item.path,
  }
})

const router = createHashRouter([
  {
    path: "/",
    element: <App />,
    children: [
      {
        path: "/",
        element: <Home />
      },
      {
        path: "exampleDetail",
        element: <ExampleDetail />,
        children
      },
      {
        path:'funList',
        element: <FunList />,
      },
      {
        path: 'article',
        element: <Article />,
      }
    ]
  },
  {
    path: "/404",
    element: <NotFound />
  },
  {
    path: "*",
    element: <Navigate to='/404' />,
  },
])

let routeList = childrenList

export {
  routeList
}

export default router